
import networkx as nx
from graspologic.partition import hierarchical_leiden

# 创建示例图
G = nx.karate_club_graph()
# 运行Leiden算法
partition = hierarchical_leiden(G, resolution=1.0)
print(f"社区划分结果: {partition}")
